'use strict';
/**
 * @name: 本地mysql连接
 * @description: 本地测试的mysql连接
 * @version: 0.0.1
 * @author: xiech
 * @Date: 2020-12-09 10:47:13
 * @LastEditors: xiech
 * @LastEditTime: 2020-12-09 10:47:14
 */

const mysql = require('mysql');

module.exports = async () => {
  return new Promise((resolve, reject) => {
    try {
      const connection = mysql.createConnection({
        host: '192.168.0.233',
        user: 'root',
        password: 'morefun1004',
        database: 'c2b'
      });
      connection.connect();
      resolve(connection);
    } catch (err) {
      reject('连接 mysql 失败,请查看!关于 mysql 的连接地址，请个人连接自己局域网中的库,如果没有请自行搭建,或者寻找网管!', JSON.stringify(err));
    }
  });
};